#define _CRT_SECURE_NO_WARNINGS
#include<iostream>

typedef char ElemType;

typedef struct LNode
{
	ElemType data;
	LNode* next;
}LNode;

typedef LNode* LinkList;

void creat(int n, LinkList& L)
{
	int i = 0;
	LNode* p;
	L = new LNode;
	L->next = NULL;

	for (int i = 0; i < n; i++)
	{
		p = new LNode;
		std::cin >> p->data;
		p->next = L->next;
		L->next = p;
	}

}

int main()
{
	LinkList L;
	int n;
	std::cin>>n;
	creat(n,L);

	int i = 0;
	LinkList t = L->next;
	int count = 0;
	for (i = 0; i < n; i++)
	{
		if ('A' <= t->data && t->data <= 'Z')
		{
			count++;
		}
		//std::cout << t->data;
		t = t->next;
	}
	//std::cout<<'\n';
	std::cout << count;

}

